{extend name="base"}
{block name="main"}
<style type="text/css">
  .number_a{color: #409EFF}
  .number_a:hover{text-decoration: underline;}
</style>
<div id="app" v-cloak>
    <el-row class="ws-quote">
        <el-col :span="24" >
            <el-button type="primary" size="small" @click="href('{:url('admin/finance/index')}')">前往财务统计</el-button>
            <el-input v-model="params.keyword" style="width: 250px;" size="small" placeholder="手机号、姓名" clearable></el-input>
            <el-select v-model="params.status" placeholder="处理状态" size="small" clearable>
                <el-option label="全部状态" value="0"></el-option>
                <el-option label="待处理" value="1"></el-option>
                <el-option label="已完成" value="2"></el-option>
                <el-option label="已拒绝" value="3"></el-option>
            </el-select>
            <el-select v-model="params.type" placeholder="全部类型" size="small" clearable>
                <el-option label="支付类型" value=""></el-option>
                <el-option label="支付宝" value="alipay"></el-option>
                <el-option label="微信" value="weixin"></el-option>
                <el-option label="银行卡" value="bank"></el-option>
            </el-select>
            <el-date-picker
                  v-model="params.range"
                  type="daterange"
                  align="right"
                  unlink-panels
                  value-format="timestamp"
                  size="small"
                  range-separator="至"
                  start-placeholder="提现时间"
                  end-placeholder="提现时间"
                  :picker-options="pickerOptions">
            </el-date-picker>
            <el-button type="primary" size="small" @click="search('{:url('')}')">搜索</el-button>
        </el-col>
    </el-row>
    
    <div class="page">
      <span class="f_r page-total">共<span>{$list->total()}</span>条</span>
      {$list->render()|raw}
    </div>

    <el-table
        :default-expand-all="false"
        border
        :data="tableData"
        style="width: 100%">
        <el-table-column
          label="单号"
          align="center"
          prop="number">
        </el-table-column>
        <el-table-column
          label="支付平台单号"
          align="center"
          prop="order_id">
        </el-table-column>
        <el-table-column
          label="姓名"
          align="center"
          prop="realname">
          <template slot-scope="r">
              <span class="number_a pointer" @click="showOrderInfo(r.row.realname)">{{r.row.realname}}</span>
          </template>
        </el-table-column>
        <el-table-column
          label="手机号"
          align="center"
          prop="tel">
          <template slot-scope="r">
              <span class="number_a pointer" @click="showOrderInfo(r.row.tel)">{{r.row.tel}}</span>
          </template>
        </el-table-column>
        <el-table-column
          label="提现类型"
          prop="type"
          align="center">
          <template slot-scope="r">
            <template v-if="r.row.type==='alipay'">支付宝</template>
            <template v-else-if="r.row.type==='weixin'">微信钱包</template>
            <template v-else-if="r.row.type==='bank'">银行卡</template>
          </template>
        </el-table-column>
        <el-table-column
          width="250px"
          align="center"
          label="支付宝、微信号、银行卡号"
          prop="bank_no">
        </el-table-column>
        <el-table-column
          label="开户行"
          prop="bank_name">
        </el-table-column>
        
        <el-table-column
          label="提现金额"
          prop="raw_money"
          align="center">
        </el-table-column>
        <el-table-column
          label="手续费"
          prop="fee"
          align="center">
        </el-table-column>
        <el-table-column
          label="个人所得税"
          prop="tax"
          align="center">
        </el-table-column>
        <el-table-column
          label="到账金额"
          prop="money"
          align="center">
        </el-table-column>
        <el-table-column
          label="累计"
          prop="amoney"
          align="center">
        </el-table-column>

        <el-table-column
          label="提现时间"
          align="center"
          width="140px"
          prop="s_time"
          sortable
          :formatter="dateFormats">
        </el-table-column>
        
        <el-table-column
          label="审核时间"
          align="center"
          prop="e_time"
          width="140px"
          sortable>
            <template slot-scope="r">
                <template v-if="r.row.state===1">{{dateFormat(r.row.e_time*1000,'Y-m-d H:i')}}</template>
                <el-tag type="warning" size="mini" v-else-if="r.row.state===2">已拒绝</el-tag>
                <el-tag type="info" size="mini" v-else>待处理</el-tag>
            </template>
        </el-table-column>
        <el-table-column
          label="处理说明"
          prop="remark"
          align="center">
        </el-table-column>
        <el-table-column label="操作" align="center">
          <template slot-scope="r">
            <el-button type="primary" size="mini" class="ws-mini" @click="edit(r.row)" v-if="!r.row.state">处理</el-button>
            <el-tag type="primary" v-else-if="r.row.state===1" size="mini">完成</el-tag>
            <el-tag type="warning" v-else-if="r.row.state===2" size="mini">拒绝</el-tag>
          </template>
        </el-table-column>
    </el-table>

    <div class="page">{$list->render()|raw}</div>

    <!-- 提现处理 start -->
    <el-dialog title="提现审核" width="500px" :visible.sync="addDialog">
      <el-form ref="forms" :model="data" :rules="rules" label-width="80px">
        <el-form-item label="审核结果">
          <el-radio-group v-model="data.state">
              <el-radio :label="0">拒绝提现</el-radio>
              <el-radio :label="1">允许提现</el-radio>
          </el-radio-group>
        </el-form-item>
        
        <el-form-item label="备注" prop="remark">
          <el-input type="textarea" v-model="data.remark" placeholder="备注"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
          <el-button @click="addDialog = false">取 消</el-button>
          <el-button type="primary" @click="onSubmit('forms','{:url(\'handle\')}')">提 交</el-button>
        </div>
    </el-dialog>
    <!-- 提现处理 end -->
</div>
{/block}

<!--------------------------分割线------------------------>
<!--------------------------分割线------------------------>
<!--------------------------分割线------------------------>

{block name="vue"}
<script>
var app=new Vue({
    el:"#app",
    mixins:[wsMixins],
    data:{
        tableData:{$list->toJson()|raw}, // 列表数据
        data:{},
        params:{$params|raw},
        addDialog:false,
        rules:{
          remark:{required:true,message:'备注项不能为空'}
        }
    },
    
    methods:{
        edit(row){
          this.data={
            id:row.id,
            state:1,
            remark:row.remark,
          }
          this.addDialog=true;
        },
        showOrderInfo(tel){
            window.location = '/admin/cash/index.html?keyword='+tel;
        },
    },
});
</script>
{/block}